﻿using System;
using System.Runtime.Serialization;

namespace Wolfpack.Contrib.Checks.Powershell
{
    internal class SnapInLoadException : Exception
    {
        private readonly string _snapIn;

        public SnapInLoadException(string snapIn, Exception innerException)
            : base(string.Format("Could not load PowerShell snapin: {0}.", snapIn), innerException)
        {
            _snapIn = snapIn;
        }

        protected SnapInLoadException(SerializationInfo info, StreamingContext context)
            : base(info, context)
        {
            _snapIn = info.GetString("snapIn");
        }

        public string SnapIn
        {
            get
            {
                return _snapIn;
            }
        }

        public override void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            base.GetObjectData(info, context);
            info.AddValue("snapIn", _snapIn);
        }


    }
}